//
// Created by wkm on 2023-12-11.
//

#ifndef MYSYSTEMCLEARNING_FULL_ADDER_MONITOR_H
#define MYSYSTEMCLEARNING_FULL_ADDER_MONITOR_H

#include <fstream>
#include "systemc.h"

SC_MODULE(monitor) {
    sc_in<bool> m_a, m_b, m_cin, m_sum, m_cout;

    ofstream outfile;

    void monitor_prc();

    SC_CTOR(monitor) {
        SC_THREAD(monitor_prc);
        sensitive << m_a << m_b << m_cin << m_sum << m_cout;
        outfile.open("full_adder.out");
    }

    // 在析构函数中关闭文件
    ~monitor() {
        outfile.close();
    }
};

#endif //MYSYSTEMCLEARNING_FULL_ADDER_MONITOR_H
